package com.example.vip31;

import android.content.Context;
import android.media.FaceDetector;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;

import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.fragment.app.Fragment;

import com.example.vip31.utils.LogUtil;

/**
 * *******************************************************
 * Author: chinadragon
 * Time: 9/26/21 10:28 PM
 * Name:
 * Overview:
 * Usage:
 * *******************************************************
 */
public class Fragment1 extends Fragment {

    @Override
    public void onAttach(@NonNull Context context) {
        super.onAttach(context);
        LogUtil.i("Fragment1 生命周期 onAttach");

    }

    @Override
    public void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        LogUtil.i("Fragment1 生命周期 onCreate");

    }

    //onCreateView 注释掉，activity可以正常运行，因为 Fragment 他的功能只是给我们一个生命周期的监听

//    @Nullable
//    @Override
//    public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
//        LogUtil.i("Fragment1 生命周期 onCreateView");
////        View view = View.inflate(getContext(), R.layout.fragment_1, container);
//        //Caused by: java.lang.IllegalStateException: The specified child already has a parent. You must call removeView() on the child's parent first.
//
//        View view = LayoutInflater.from(getContext()).inflate( R.layout.fragment_1, container, false);
//        return view;
//    }

    @Override
    public void onActivityCreated(@Nullable Bundle savedInstanceState) {
        super.onActivityCreated(savedInstanceState);
        LogUtil.i("Fragment1 生命周期 onActivityCreated");

    }

    @Override
    public void onStart() {
        super.onStart();
        LogUtil.i("Fragment1 生命周期 onStart");

    }
    

    @Override
    public void onResume() {
        super.onResume();
        LogUtil.i("Fragment1 生命周期 onResume");

    }

    @Override
    public void onPause() {
        super.onPause();
        LogUtil.i("Fragment1 生命周期 onPause");

    }

    @Override
    public void onStop() {
        super.onStop();
        LogUtil.i("Fragment1 生命周期 onStop");

    }

    @Override
    public void onDestroyView() {
        super.onDestroyView();
        LogUtil.i("Fragment1 生命周期 onDestroyView");

    }

    @Override
    public void onDestroy() {
        super.onDestroy();
        LogUtil.i("Fragment1 生命周期 onDestroy");
    }

    @Override
    public void onDetach() {
        super.onDetach();
        LogUtil.i("Fragment1 生命周期 onDetach");

    }
}
